layui.define(['layer','jquery','form','laydate'], function (exports) {
    var $ = layui.jquery;
    var layer=layui.layer;
    var laydate = layui.laydate;
    var form = layui.form();

    var index = parent.layer.getFrameIndex(window.name);

    form.on('select(edit_status)', function(data){
        $("#takes_code").val('');
        //var takes_status = data.value;
        //var edit_id = $("#edit_id").val();
        ///*修改维修状态*/
        //$.ajax({
        //    datatype:'string',
        //    type:'post',
        //    data:{"tpl":"edit_status","takes_status":takes_status,"edit_id":edit_id},
        //    url:'./srv/sdo.php',
        //    async:true,
        //    success:function(d){
        //        if(d == 'ok'){
        //            location.reload();
        //            //form.render('select');
        //        }
        //
        //    }
        //});
    });

    $("#btn_callback").click(function(){
        var m_val=$(this).attr('data-id');
        layer.confirm('确定撤回此申请吗？',function(index){
            $.post("/srv/sdo.php", {tpl:"repair_callback",id:m_val}, function (d, e) {
                if(d=="ok"){
                    location.reload();
                }
            });
        });

    });
    $("#btn_takes_code").click(function(){
        var status_val = $("#edit_status option:selected").val();
        var m_val=$(this).attr('data-id');
        var takes_code=$("#takes_code").val();
        layer.confirm('确定备注此维修项目吗？',function(index){
            $.post("/srv/sdo.php", {tpl:"btn_takes_code",id:m_val,takes_code:takes_code,status_val:status_val}, function (d, e) {
                if(d=="ok"){
                    location.reload();
                }
            });
        });
    });
    /*管理员备注*/
    $("#btn_takes_code_admin").click(function(){
        var status_val = $("#edit_status option:selected").val();
        var m_val=$(this).attr('data-id');
        var takes_code=$("#takes_code").val();
        layer.confirm('确定备注此维修项目吗？',function(index){
            $.post("/srv/sdo.php", {tpl:"btn_takes_code_admin",id:m_val,takes_code:takes_code,status_val:status_val}, function (d, e) {
                if(d=="ok"){
                    location.reload();
                }
            });
        });
    });

    $("#btn_add_evaluate").click(function(){
        var m_val=$(this).attr('data-id');
        var evaluate_val=$("#evaluate").val();
        layer.confirm('确定追加评价吗？',function(index){
            $.post("/srv/sdo.php", {tpl:"btn_add_evaluate",id:m_val,evaluate:evaluate_val}, function (d, e) {
                if(d=="ok"){
                    location.reload();
                }
            });
        });

    });





    
    exports('repair_detail', {});
});